package com.cl.cloud.auth.exception;

import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.oauth2.common.exceptions.OAuth2Exception;

/**
 * @description: 自定义OAuth2Exception 封装了一层 可以与 {@link CustomWebResponseExceptionTranslator} 配合使用
 * @author: liuzijian
 * @time: 2022-05-12 11:40
 */
public class CustomOAuth2Exception extends OAuth2Exception {

    @Setter
    @Getter
    private int httpErrorCode;

    public CustomOAuth2Exception(String msg, Throwable t) {
        super(msg, t);
    }

    public CustomOAuth2Exception(String msg, Throwable t, Integer httpErrorCode) {
        super(msg, t);
        this.httpErrorCode = httpErrorCode;
    }

    public CustomOAuth2Exception buildAdditionalInformation(String key, String value) {
        super.addAdditionalInformation(key,value);
        return this;
    }
}
